<?php
/*
need php programming?
contact flvhosting.com
*/

require_once './config.php' ;
require_once _LIB.'/abstract.php' ;
require_once _LIB.'/mysql.php' ;
require_once _LIB.'/paginate.php' ;
require_once _LIB.'/main.php' ;

if ($_REQUEST["url"]){
	$url = 'movies/'.$_REQUEST["url"];
	$item = mov_get_by_name($_REQUEST["url"]);
}
else {
   $url = 'movies/ad.flv';
   $item = mov_get_by_name('ad.flv');
}
if(!$_REQUEST[o])
	$_REQUEST[o] = 'name';
if(!$_REQUEST[p])
	$_REQUEST[p] = 1 ;
$order = '';
switch($_REQUEST[o]) {
	case 'name' : $order = 'm_name'; break;
	case 'date' : $order = 'm_date DESC'; break;
	case 'size' : $order = 'm_fsize DESC'; break;
} // s w i t c h
$all_cnt = mov_get_db_count();
$pm = paginate($all_cnt ,'p',array('itemsperpage'=> (_DISP_NUM ? _DISP_NUM : 3), 'items'=>3, 'requesttail'=>'&o='.$_REQUEST[o])) ;
$range = $pm->get_range();
$page = mov_get_by_range($range, $order);
$nums = $pm->show() ;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Now Watching: <?=$item[1]?></TITLE>
<link rel="stylesheet" type="text/css" href="site.css">
<style>
<!--
#flashcontent {
	border: solid 0px #FFF;
	width: 320px;
	height: 310px;
	float: center;
	margin: 0px 0px;
}
//-->
</style>
<script type="text/javascript" src="swfobject.js"></script>
<script language="JavaScript">
<!--
function fullwin(targeturl){
window.open(targeturl,"", "scrollbars=yes,resizable=yes,width=640,height=480")
}
//-->
</script>
</HEAD>
<body bgcolor="" text="white" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<TABLE border=0 cellspacing=0 cellpadding=0 align=center width="760" align="center">
<TR>
	<TD valign="top" align="center">
<TABLE border=0 cellspacing=0 cellpadding=0 align=center width=350>
<TR>
	<TD valign="top" align="center" class="b" width="350">

<!-- <object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="310" id="pass_url_v1" align="middle">
<PARAM NAME=FlashVars VALUE="url=../<?=$url?>&text=<?=$item[3]?>">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="system/pass_url_v1.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<embed src="system/pass_url_v1.swf" FlashVars="url=../<?=$url?>&text=<?=$item[3]?>" quality="high" bgcolor="#ffffff" width="320" height="310" name="pass_url_v1" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object> -->

<!-- start -->
	<div id="flashcontent">
<strong>You need to upgrade your Flash Player</strong><BR>
		It appears you do not have the Flash 7 plugin or have you have Javascript turned off. Please click <a href="player.php?detectflash=false">this link</a> to <a href="player.php?detectflash=false">bypass the detection</a> if you wish.
	</div>

	<script type="text/javascript">
		// <![CDATA[

		var fo = new SWFObject("system/pass_url_v1.swf", "pass_url_v1", "320", "310", "7", "#FFFFFF");
		fo.addVariable("url", "../<?=$url?>");
		fo.addVariable("text", "<?=$item[3]?>");
		//fo.addVariable("flashVarText", "this is passed in via FlashVars for example only"); // this line is optional, but this example uses the variable and displays this text inside the flash movie
		fo.write("flashcontent");

		// ]]>
	</script>
<!-- end -->

<BR>
<B>Now Watching:</B> <font size="2" color="#FF0D0D"><B>

	<?=$item[1]?>

</B></font>
</TD>
</TR>
</TABLE>
</TD>

<td valign="top" width="410">
<TABLE border=0 cellspacing=0 bgcolor=white cellpadding=0 align=center width=410>
<TR>
	<TD valign="top" align="center"><BR>
<h1>Select A Video Below</h1>
</tr></td>
<tr>
	<TD valign="top" align="center">

	<p>
	Sort movies by
		<b><a href="<?=_ME?>?o=name">name</a></b>,
		<b><a href="<?=_ME?>?o=date">date</a></b> or
		<b><a href="<?=_ME?>?o=size">size</a></b>
	</p>

<?php
if(!empty($page)) {
	//debug($range);
	//echo '<p align=center>'.$nums.'</p>'._E ;
	echo '<table width="410" cellpadding="2" cellspacing="2"  border="0" frame="void" rules="rows">'._E ;
		for($i=0; $i<count($page); $i++) {
			$clipurl = $page[$i][4];
			if (!$isSubscriber) $clipurl = 'ad.flv'; // teaser video
			echo '<tr>'._E ;
				echo '<td valign=top>'._E ;
					echo '<b>'.($range[$i]+1).'</b>.'._E;
				echo '</td>'._E ;
				echo '<td valign=middle align=center>'._E ;
					echo '<a href="'._ME.'?url='.$clipurl.'&p='.$_REQUEST[p].'&o='.$_REQUEST[o].'" title="Watch now!"><img src="'.($page[$i][2]).'" border="0"></a>'._E ;
				echo '</td>'._E ;
				echo '<td valign=top>'._E ;
					echo '<b>'.($page[$i][1]).'</b><br>'._E ;
					echo 'File size: '.format_fsize($page[$i][5]).'<br>'._E ;
					echo 'Date: '.substr($page[$i][7],0,10).'<br>'._E ;
					echo ''.nl2br($page[$i][6]).'<br>'._E ;
				echo '</td>'._E ;
			echo '</tr>'._E ;
		} // f o r
	echo '</table>'._E ;
	echo '<p align=center>'.$nums.'</p>'._E ;
} // i f
else {
	echo 'Nothing to watch!' ;
} // e l s e
?>

Sort movies by
		<b><a href='<?=_ME?>?o=name'>name</a></b>,
		<b><a href="<?=_ME?>?o=date">date</a></b>

</td>
</TR>
</TABLE>


</TD>
</TR>
</TABLE>
</BODY>
</HTML>
